using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Resources;
using System.Globalization;

using FilesWebService;
using System.Collections.Generic;

public partial class _Player : System.Web.UI.Page
{
    #region Fields
    private ResourceManager _resourceMgr;
    private CultureInfo _ci;
    private FilesWS _filesWS;
    private StoredFileInfo[] _files;
    #endregion

    #region Events
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Expires = 0;

        _resourceMgr = ResourceManager.CreateFileBasedResourceManager("Language", @"C:\inetpub\wwwroot\desarrollo\SoinusWeb\Languages", null);
        _ci = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

        this.initializeServices();

        this.lnkBtnLogout.Text = _resourceMgr.GetString("lnkBtnSignOut", _ci);
    }
    protected void lnkBtnLogout_Click(object sender, EventArgs e)
    {
        this.logOut();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        this.Response.Redirect("Player.aspx");
    }
    #endregion

    #region Methods - Private
    private void initializeServices()
    {
        AuthHeader authentication;

        _filesWS = new FilesWS();
        authentication = new AuthHeader();
        authentication.Username = this.Session["username"] as String;
        authentication.Password = this.Session["password"] as String;
        _filesWS.AuthHeaderValue = authentication;
    }

    private void logOut()
    {
        FormsAuthentication.SignOut();
        Session.Abandon();
        Response.Redirect("Logout.aspx");
    } 
    #endregion
}
